home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <string.h>
-
- int main(int argc, char **argv)
- {
- FILE *f;
- int major, minor, day, month, year;
- char pathname[1024];
-
- if (argc != 2)
- {
- fprintf(stderr, "Usage: parse_version <srcdir>\n");
- exit(2);
- }
- strcpy(pathname, argv[1]);
- strcat(pathname, "/../version.in");
- f = fopen(pathname, "r");
- if (f == NULL)
- {
- fprintf(stderr, "Cannot open %s\n", pathname);
- exit(2);
- }
- fscanf(f, "%d.%d,%d.%d.%d", &major, &minor, &day, &month, &year);
- fclose(f);
- f = fopen("version.c", "w");
- fprintf(f, "/*\n * version.c file. Automatically generated by parse_version.\n */\n\n");
- fprintf(f, "static const char version_id[] = \"\\000$VER: ixemul.library %d.%d (%d.%d.%d)\";\n",
- major, minor, day, month, year);
- fclose(f);
- fopen("version.h", "w");
- fprintf(f, "/*
- * version.h file. Automatically generated by parse_version.
- */
-
- #ifndef __VERSION_H__
- #define __VERSION_H__
-
- /* Commodities.h defines IX_VERSION too, so wait for our defines
- to come last, and undef the sucker now! */
- #undef IX_VERSION
-
- #define IX_NAME \"ixemul.library\"
- #define IX_IDSTRING \"ixemul %d.%d (%d.%d.%d)\"
- #define IX_VERSION %d
- #define IX_REVISION %d
- #define IX_PRIORITY 0
-
- #endif
- ", major, minor, day, month, year, major, minor);
- fclose(f);
- return 0;
- }
-